<script setup lang="ts">
import { useStatistic } from '@/composables/useStatistic'
import UserInfo from './components/UserInfo.vue'

const { loading, statisticsData, homeTotalData } = useStatistic()
</script>

<template>
  <main-container
    class="dashboard-container"
    :show-pagination="false"
    :show-bg-white="false"
    :loading="loading"
  >
    <div class="h-full flex flex-col p-0 space-y-2">
      <user-info />
      <div class="resource-view flex-1">
        <h1 class="m-0 p-0 text-xl font-700">
          区域资源概览
        </h1>
        <div class="flex flex-col space-y-6">
          <statistics-resource :data="statisticsData" />
          <div
            v-for="item in homeTotalData"
            :key="item.title"
            class="flex flex-col space-y-4"
          >
            <div class="flex items-center space-x-1">
              <i-icons-area class="size-6!" />
              <span class="text-base font-700 text-color-1">{{
                item.title
              }}</span>
            </div>
            <resource-card
              :data="item.ipList"
              type="IP"
              home-show-total
            />
            <resource-card
              :data="item.bandWidthList"
              type="带宽"
              home-show-total
            />
          </div>
        </div>
      </div>
    </div>
  </main-container>
</template>

<style scoped lang="less">
.resource-view {
  border: 1px solid var(--white, #fff);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, #fff 10%);
  backdrop-filter: blur(5px);
  @apply w-full rounded-xl  flex flex-col space-y-6 p-6;
}
</style>

<style lang="less">
.dashboard-container {
  .res-scrollbar__view {
    @apply p-0 h-full;
    > div {
      @apply mt-0;
      &:first-child {
        @apply h-full;
      }
    }
  }
}
</style>
